<?php
    class Form_validate_demo extends CI_Controller {
        function __construct(){
            parent::__construct();
            $this->load->library('form_validate');
        }

        function index(){
            $this->load->view('handround/form_test_view');
        }

        function validate(){
//		$this->form_validate->first_error_only();
            $this->form_validate->set_rules('un','用户名','require');
            $this->form_validate->set_rules ( 'p', '密码', 'require|length(9,12)|password' );
            $this->form_validate->set_rules ( 'p1', '密码', 'equal(p)');
            $this->form_validate->set_rules ( 'mail', '邮箱', 'mail');
            $this->form_validate->set_rules ( 'ic', '身份证', 'idcard');
            $this->form_validate->set_rules ( 'mobile', '手机号', 'mobile');
            $this->form_validate->set_rules ( 'qq', 'QQ号', 'qq');
            if (! $this->form_validate->is_valid ( $_POST )) {
                var_dump ( $this->form_validate->get_errors () );
            }
        }
    }
?>